package com.example.picturebacked.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.picturebacked.model.dto.space.SpaceAddRequest;
import com.example.picturebacked.model.dto.space.SpaceQueryRequest;
import com.example.picturebacked.model.entity.Space;
import com.baomidou.mybatisplus.extension.service.IService;
import com.example.picturebacked.model.entity.User;
import com.example.picturebacked.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lbt
 * @description 针对表【space(空间)】的数据库操作Service
 * @createDate 2025-09-02 15:15:47
 */
public interface SpaceService extends IService<Space> {
    /**
     * 获取空间封装类，并同时给空间加入创建用户的信息
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 分页获取空间封装
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);

    /**
     * 空间数据校验
     *
     * @param space
     */
    void validSpace(Space space, boolean add);

    /**
     * 获取查询对象
     */
    QueryWrapper<Space> getQueryWrapepr(SpaceQueryRequest spaceQueryRequest);

    /**
     * 自动填充空间的最大容量以及最大条数
     *
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 用户创建空间
     */
    long addSpace(SpaceAddRequest spaceAddRequest, User loginUser);

    /**
     * 判断用户权限
     */
    void checkSpaceAuth(Space space, User loginUser);

}
